package com.example.graduate.pojo;

import com.example.graduate.dto.AddOrderRequest;
import com.example.graduate.env.TaskStatusEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * task 表的po类
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Task {
    /**
     * 主键
     */
    private Long id;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 订单ID
     */
    private Long orderId;

    /**
     * 任务状态
     */
    private String taskStatus;

    /**
     * 代购地址
     */
    private String location;

    /**
     * 代购企业
     */
    private String company;

    /**
     * 代购说明
     */
    private String declare;

    /**
     * 代购赏金
     */
    private BigDecimal award;

    /**
     * 代购物品重量
     */
    private String heavy;

    /**
     * 收货人
     */
    private String name;

    /**
     * 收货手机号
     */
    private String phone;

    /**
     * 收货地址
     */
    private String address;

    public Task(AddOrderRequest addOrderRequest){
        this.heavy = addOrderRequest.getHeavy();
        this.declare = addOrderRequest.getDeclare();
        this.award = addOrderRequest.getAward();
        this.company = addOrderRequest.getCompany();
        this.location = addOrderRequest.getLocation();
        this.taskStatus = TaskStatusEnum.UNCOMPLETED.getCode();
        this.userId = addOrderRequest.getUserId();
        this.name = addOrderRequest.getName();
        this.phone = addOrderRequest.getPhone();
        this.address = addOrderRequest.getAddress();
    }
}

